﻿using Microsoft.Practices.Unity;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace DI
{
    public abstract class DiConfigBase : IDiConfig
    {
        static protected ContainerControlledLifetimeManager getSingleton()
        {
            return new ContainerControlledLifetimeManager();
        }

        IUnityContainer container;

        #region IDiConfig Members

        public Microsoft.Practices.Unity.IUnityContainer Container
        {
            get
            {
                if (container == null)
                    container = CreateContainer();

                return container;
            }
        }

        protected abstract IUnityContainer CreateContainer();

        #endregion
    }
}
